package cn.anecansaitin.whimsy.mixin.client;

import cn.anecansaitin.whimsy.client.event.ModClientEventHooks;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Camera;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GameRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

@Mixin(GameRenderer.class)
public class GameRendererMixin {
    //这个mixin是为了添加一个摄像机初始化的事件，用于自定义调整镜头位置
    @Inject(method = "renderLevel",
            at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Camera;setup(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/world/entity/Entity;ZZF)V", shift = At.Shift.AFTER))
    public void modify$renderLevel(float partialTicks, long finishTimeNano, PoseStack poseStack, CallbackInfo ci) {
        ModClientEventHooks.onCameraSetup();
    }
}
